package cn.source.system.service.impl;

import cn.source.common.utils.DateUtils;
import cn.source.system.domain.NavCategory;
import cn.source.system.mapper.NavCategoryMapper;
import cn.source.system.service.INavCategoryService;
import lombok.AllArgsConstructor;
import org.springframework.stereotype.Service;

import java.util.List;

/**
 * @program: source-vue
 * @ClassName: NavCategoryServiceImpl
 * @description: 导航分类Service业务层处理
 * @author: 诗涵
 * @create: 2024-02-20 17:04
 */
@Service
@AllArgsConstructor
public class NavCategoryServiceImpl implements INavCategoryService {

    private final NavCategoryMapper navCategoryMapper;

    /**
     * 查询导航分类
     *
     * @param id 导航分类主键
     * @return 导航分类
     */
    @Override
    public NavCategory selectNavCategoryById(Long id)
    {
        return navCategoryMapper.selectNavCategoryById(id);
    }

    /**
     * 查询导航分类列表
     *
     * @param navCategory 导航分类
     * @return 导航分类
     */
    @Override
    public List<NavCategory> selectNavCategoryList(NavCategory navCategory)
    {
        return navCategoryMapper.selectNavCategoryList(navCategory);
    }

    /**
     * 新增导航分类
     *
     * @param navCategory 导航分类
     * @return 结果
     */
    @Override
    public int insertNavCategory(NavCategory navCategory)
    {
        navCategory.setCreateTime(DateUtils.getNowDate());
        return navCategoryMapper.insertNavCategory(navCategory);
    }

    /**
     * 修改导航分类
     *
     * @param navCategory 导航分类
     * @return 结果
     */
    @Override
    public int updateNavCategory(NavCategory navCategory)
    {
        navCategory.setUpdateTime(DateUtils.getNowDate());
        return navCategoryMapper.updateNavCategory(navCategory);
    }

    /**
     * 批量删除导航分类
     *
     * @param ids 需要删除的导航分类主键
     * @return 结果
     */
    @Override
    public int deleteNavCategoryByIds(Long[] ids)
    {
        return navCategoryMapper.deleteNavCategoryByIds(ids);
    }
}
